//https://leetcode.cn/problems/he-bing-liang-ge-pai-xu-de-lian-biao-lcof/description/

struct ListNode* trainningPlan(struct ListNode* l1, struct ListNode* l2) {
    if (l1 == NULL)
    {
        return l2;
    }
    if (l2 == NULL)
    {
        return l1;
    }

    struct ListNode* head = NULL;
    if (l1->val < l2->val)
    {
        head = l1;
        head->next = trainningPlan(l1->next, l2);
    }
    if (l1->val >= l2->val)
    {
        head = l2;
        head->next = trainningPlan(l1, l2->next);
    }


    return head;

    /*struct ListNode*cur1=l1;
    struct ListNode*cur2=l2;
    struct ListNode*guard=NULL;
    struct ListNode*tail=NULL;
    guard=tail=(struct ListNode*)malloc(sizeof(struct ListNode));

    tail->next=NULL;

    while(cur1&&cur2)
    {
        if(cur1->val<cur2->val)
        {
            tail->next=cur1;
            tail=cur1;
            cur1=cur1->next;
        }
        else
        {
            tail->next=cur2;
            tail=cur2;
            cur2=cur2->next;
        }
    }

    if(cur1)
    {
        tail->next=cur1;
    }

    if(cur2)
    {
        tail->next=cur2;
    }

    struct ListNode*head=guard->next;
    free(guard);

    return head;*/
}